using System;
using System.Data;
using System.Collections.Generic;

namespace Dbam.DbFramework.Tests
{
	[Table("Accounts")]
	class Account
	{
		private Guid _id;
		private string _name;
		private DateTime? _lastLogon;
		private DateTime _openDate;
		private List<Session> _sessions;

		public Account()
		{
			_id = Guid.NewGuid();
			_name = "New Account";
			_lastLogon = null;
			_openDate = DateTime.Now;
			_sessions = new List<Session>();
		}

		[Column("Id", DbType.Guid, true)]
		public Guid Id
		{
			get { return _id; }
			set { _id = value; }
		}

		[Column("Name", DbType.String, false)]
		public string Name
		{
			get { return _name; }
			set { _name = value; }
		}

		[Column("LastLogon", DbType.DateTime, false)]
		public DateTime? LastLogon
		{
			get { return _lastLogon; }
			set { _lastLogon = value; }
		}

		[Column("OpenDate", DbType.DateTime, false)]
		public DateTime OpenDate
		{
			get { return _openDate; }
			set { _openDate = value; }
		}

		[ForeignColumnMapping("Id", "Sessions", "AccountId", typeof(Session), true)]
		public List<Session> Sessions
		{
			get { return _sessions; }
		}
	}
}